package com.iv.durian.cloud.facade.support;


import com.iv.durian.cloud.User;
import com.iv.durian.cloud.facade.UserFacade;
import com.iv.durian.cloud.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class UserFacadeImpl implements UserFacade {

    @Autowired
    private UserService userService;

    @Override
    public User get(@PathVariable(name = "userId") Integer userId){
        return userService.get(userId);
    }

    @Override
    public User get(@PathVariable(name = "mobileOrEmail") String mobileOrEmail){
        return userService.get(mobileOrEmail);
    }

    @Override
    public void add(User user) {
         userService.add(user);
    }

    @Override
    public void updatePassword(Integer userId, String password) {
        userService.updatePassword(userId,password);
    }

    @Override
    public int updateTicket( int id, String ticket,long expire){
        return userService.updateTicket(id,ticket,expire);
    }

    @Override
    public int cleanTicket( int id){
        return userService.cleanTicket(id);
    }

    @Override
    public User getByTicket(String ticket) {
        return userService.getByTicket(ticket);
    }

}
